package me.pcqpcq.android.tvlauncher.fragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import me.pcqpcq.android.tvlauncher.BaseFragment;
import me.pcqpcq.android.tvlauncher.R;
import me.pcqpcq.android.tvlauncher.activity.AllAppsActivity;

/**
 *
 * 系统快捷栏区域
 * @author pcqpcq
 * @version 1.0.0
 * @since 13-10-22 下午11:46
 */
public class SystemDockFragment extends BaseFragment implements View.OnClickListener {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_system_dock, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        view.findViewById(R.id.imv_sysdock_sys1).setOnClickListener(this);
        view.findViewById(R.id.imv_sysdock_sys2).setOnClickListener(this);
        view.findViewById(R.id.imv_sysdock_sys3).setOnClickListener(this);
        view.findViewById(R.id.imv_sysdock_sys4).setOnClickListener(this);
        view.findViewById(R.id.imv_sysdock_sys5).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent i = new Intent();
        switch (v.getId()) {
            case R.id.imv_sysdock_sys1:
                i.setAction(MediaStore.ACTION_VIDEO_CAPTURE);
                break;

            case R.id.imv_sysdock_sys2:
                i.setAction(MediaStore.ACTION_IMAGE_CAPTURE);
                break;

            case R.id.imv_sysdock_sys3:
                i.setAction(Intent.ACTION_VIEW);
                i.setData(Uri.parse("http://"));
                break;

            case R.id.imv_sysdock_sys4:
                i.setAction(Intent.ACTION_VIEW);
                i.putExtra("sms_body", "");
                i.setType("vnd.android-dir/mms-sms");
                break;

            case R.id.imv_sysdock_sys5:
                i.setAction(Settings.ACTION_SETTINGS);
                break;
            default:
                break;
        }
        startActivity(i);
    }

}
